3.240 \(\int \tan ^2(c+d x) (a+b \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx\)

Optimal. Leaf size=148 \[ \frac {\left (a^2 B+2 a A b-b^2 B\right ) \log (\cos (c+d x))}{d}-x \left (a^2 A-2 a b B-A b^2\right )+\frac {(4 A b-a B) (a+b \tan (c+d x))^3}{12 b^2 d}-\frac {b (a B+A b) \tan (c+d x)}{d}+\frac {B \tan (c+d x) (a+b \tan (c+d x))^3}{4 b d}-\frac {B (a+b \tan (c+d x))^2}{2 d} \]

[Out]

-(A*a^2-A*b^2-2*B*a*b)*x+(2*A*a*b+B*a^2-B*b^2)*ln(cos(d*x+c))/d-b*(A*b+B*a)*tan(d*x+c)/d-1/2*B*(a+b*tan(d*x+c)
)^2/d+1/12*(4*A*b-B*a)*(a+b*tan(d*x+c))^3/b^2/d+1/4*B*tan(d*x+c)*(a+b*tan(d*x+c))^3/b/d

________________________________________________________________________________________

Rubi [A]  time = 0.27, antiderivative size = 148, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, integrand size = 31, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.161, Rules used = {3607, 3630, 3528, 3525, 3475} \[ \frac {\left (a^2 B+2 a A b-b^2 B\right ) \log (\cos (c+d x))}{d}-x \left (a^2 A-2 a b B-A b^2\right )+\frac {(4 A b-a B) (a+b \tan (c+d x))^3}{12 b^2 d}-\frac {b (a B+A b) \tan (c+d x)}{d}+\frac {B \tan (c+d x) (a+b \tan (c+d x))^3}{4 b d}-\frac {B (a+b \tan (c+d x))^2}{2 d} \]

Antiderivative was successfully verified.

[In]

Int[Tan[c + d*x]^2*(a + b*Tan[c + d*x])^2*(A + B*Tan[c + d*x]),x]

[Out]

-((a^2*A - A*b^2 - 2*a*b*B)*x) + ((2*a*A*b + a^2*B - b^2*B)*Log[Cos[c + d*x]])/d - (b*(A*b + a*B)*Tan[c + d*x]
)/d - (B*(a + b*Tan[c + d*x])^2)/(2*d) + ((4*A*b - a*B)*(a + b*Tan[c + d*x])^3)/(12*b^2*d) + (B*Tan[c + d*x]*(
a + b*Tan[c + d*x])^3)/(4*b*d)

Rule 3475

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3525

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(a*c - b
*d)*x, x] + (Dist[b*c + a*d, Int[Tan[e + f*x], x], x] + Simp[(b*d*Tan[e + f*x])/f, x]) /; FreeQ[{a, b, c, d, e
, f}, x] && NeQ[b*c - a*d, 0] && NeQ[b*c + a*d, 0]

Rule 3528

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(d
*(a + b*Tan[e + f*x])^m)/(f*m), x] + Int[(a + b*Tan[e + f*x])^(m - 1)*Simp[a*c - b*d + (b*c + a*d)*Tan[e + f*x
], x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && GtQ[m, 0]

Rule 3607

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e
_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Simp[(b*B*(a + b*Tan[e + f*x])^(m - 1)*(c + d*Tan[e + f*x])^(n + 1))/(d*
f*(m + n)), x] + Dist[1/(d*(m + n)), Int[(a + b*Tan[e + f*x])^(m - 2)*(c + d*Tan[e + f*x])^n*Simp[a^2*A*d*(m +
 n) - b*B*(b*c*(m - 1) + a*d*(n + 1)) + d*(m + n)*(2*a*A*b + B*(a^2 - b^2))*Tan[e + f*x] - (b*B*(b*c - a*d)*(m
 - 1) - b*(A*b + a*B)*d*(m + n))*Tan[e + f*x]^2, x], x], x] /; FreeQ[{a, b, c, d, e, f, A, B, n}, x] && NeQ[b*
c - a*d, 0] && NeQ[a^2 + b^2, 0] && NeQ[c^2 + d^2, 0] && GtQ[m, 1] && (IntegerQ[m] || IntegersQ[2*m, 2*n]) &&
 !(IGtQ[n, 1] && ( !IntegerQ[m] || (EqQ[c, 0] && NeQ[a, 0])))

Rule 3630

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)] + (C_.)*tan[(e_.) + (
f_.)*(x_)]^2), x_Symbol] :> Simp[(C*(a + b*Tan[e + f*x])^(m + 1))/(b*f*(m + 1)), x] + Int[(a + b*Tan[e + f*x])
^m*Simp[A - C + B*Tan[e + f*x], x], x] /; FreeQ[{a, b, e, f, A, B, C, m}, x] && NeQ[A*b^2 - a*b*B + a^2*C, 0]
&&  !LeQ[m, -1]

Rubi steps

\begin {align*} \int \tan ^2(c+d x) (a+b \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx &=\frac {B \tan (c+d x) (a+b \tan (c+d x))^3}{4 b d}+\frac {\int (a+b \tan (c+d x))^2 \left (-a B-4 b B \tan (c+d x)+(4 A b-a B) \tan ^2(c+d x)\right ) \, dx}{4 b}\\ &=\frac {(4 A b-a B) (a+b \tan (c+d x))^3}{12 b^2 d}+\frac {B \tan (c+d x) (a+b \tan (c+d x))^3}{4 b d}+\frac {\int (a+b \tan (c+d x))^2 (-4 A b-4 b B \tan (c+d x)) \, dx}{4 b}\\ &=-\frac {B (a+b \tan (c+d x))^2}{2 d}+\frac {(4 A b-a B) (a+b \tan (c+d x))^3}{12 b^2 d}+\frac {B \tan (c+d x) (a+b \tan (c+d x))^3}{4 b d}+\frac {\int (a+b \tan (c+d x)) (-4 b (a A-b B)-4 b (A b+a B) \tan (c+d x)) \, dx}{4 b}\\ &=-\left (a^2 A-A b^2-2 a b B\right ) x-\frac {b (A b+a B) \tan (c+d x)}{d}-\frac {B (a+b \tan (c+d x))^2}{2 d}+\frac {(4 A b-a B) (a+b \tan (c+d x))^3}{12 b^2 d}+\frac {B \tan (c+d x) (a+b \tan (c+d x))^3}{4 b d}+\left (-2 a A b-a^2 B+b^2 B\right ) \int \tan (c+d x) \, dx\\ &=-\left (a^2 A-A b^2-2 a b B\right ) x+\frac {\left (2 a A b+a^2 B-b^2 B\right ) \log (\cos (c+d x))}{d}-\frac {b (A b+a B) \tan (c+d x)}{d}-\frac {B (a+b \tan (c+d x))^2}{2 d}+\frac {(4 A b-a B) (a+b \tan (c+d x))^3}{12 b^2 d}+\frac {B \tan (c+d x) (a+b \tan (c+d x))^3}{4 b d}\\ \end {align*}

________________________________________________________________________________________

Mathematica [C]  time = 6.21, size = 221, normalized size = 1.49 \[ \frac {B \tan (c+d x) (a+b \tan (c+d x))^3}{4 b d}+\frac {\frac {(4 A b-a B) (a+b \tan (c+d x))^3}{3 b d}+\frac {2 \left ((A b-a B) \left (-i (a-i b)^2 \log (\tan (c+d x)+i)+i (a+i b)^2 \log (-\tan (c+d x)+i)-2 b^2 \tan (c+d x)\right )-B \left (6 a b^2 \tan (c+d x)+(-b+i a)^3 \log (-\tan (c+d x)+i)-(b+i a)^3 \log (\tan (c+d x)+i)+b^3 \tan ^2(c+d x)\right )\right )}{d}}{4 b} \]

Antiderivative was successfully verified.

[In]

Integrate[Tan[c + d*x]^2*(a + b*Tan[c + d*x])^2*(A + B*Tan[c + d*x]),x]

[Out]

(B*Tan[c + d*x]*(a + b*Tan[c + d*x])^3)/(4*b*d) + (((4*A*b - a*B)*(a + b*Tan[c + d*x])^3)/(3*b*d) + (2*((A*b -
 a*B)*(I*(a + I*b)^2*Log[I - Tan[c + d*x]] - I*(a - I*b)^2*Log[I + Tan[c + d*x]] - 2*b^2*Tan[c + d*x]) - B*((I
*a - b)^3*Log[I - Tan[c + d*x]] - (I*a + b)^3*Log[I + Tan[c + d*x]] + 6*a*b^2*Tan[c + d*x] + b^3*Tan[c + d*x]^
2)))/d)/(4*b)

________________________________________________________________________________________

fricas [A]  time = 1.43, size = 146, normalized size = 0.99 \[ \frac {3 \, B b^{2} \tan \left (d x + c\right )^{4} + 4 \, {\left (2 \, B a b + A b^{2}\right )} \tan \left (d x + c\right )^{3} - 12 \, {\left (A a^{2} - 2 \, B a b - A b^{2}\right )} d x + 6 \, {\left (B a^{2} + 2 \, A a b - B b^{2}\right )} \tan \left (d x + c\right )^{2} + 6 \, {\left (B a^{2} + 2 \, A a b - B b^{2}\right )} \log \left (\frac {1}{\tan \left (d x + c\right )^{2} + 1}\right ) + 12 \, {\left (A a^{2} - 2 \, B a b - A b^{2}\right )} \tan \left (d x + c\right )}{12 \, d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)^2*(a+b*tan(d*x+c))^2*(A+B*tan(d*x+c)),x, algorithm="fricas")

[Out]

1/12*(3*B*b^2*tan(d*x + c)^4 + 4*(2*B*a*b + A*b^2)*tan(d*x + c)^3 - 12*(A*a^2 - 2*B*a*b - A*b^2)*d*x + 6*(B*a^
2 + 2*A*a*b - B*b^2)*tan(d*x + c)^2 + 6*(B*a^2 + 2*A*a*b - B*b^2)*log(1/(tan(d*x + c)^2 + 1)) + 12*(A*a^2 - 2*
B*a*b - A*b^2)*tan(d*x + c))/d

________________________________________________________________________________________

giac [B]  time = 3.34, size = 2228, normalized size = 15.05 \[ \text {result too large to display} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)^2*(a+b*tan(d*x+c))^2*(A+B*tan(d*x+c)),x, algorithm="giac")

[Out]

-1/12*(12*A*a^2*d*x*tan(d*x)^4*tan(c)^4 - 24*B*a*b*d*x*tan(d*x)^4*tan(c)^4 - 12*A*b^2*d*x*tan(d*x)^4*tan(c)^4
- 6*B*a^2*log(4*(tan(d*x)^4*tan(c)^2 - 2*tan(d*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan
(c) + 1)/(tan(c)^2 + 1))*tan(d*x)^4*tan(c)^4 - 12*A*a*b*log(4*(tan(d*x)^4*tan(c)^2 - 2*tan(d*x)^3*tan(c) + tan
(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan(c) + 1)/(tan(c)^2 + 1))*tan(d*x)^4*tan(c)^4 + 6*B*b^2*log(4*(ta
n(d*x)^4*tan(c)^2 - 2*tan(d*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan(c) + 1)/(tan(c)^2
+ 1))*tan(d*x)^4*tan(c)^4 - 48*A*a^2*d*x*tan(d*x)^3*tan(c)^3 + 96*B*a*b*d*x*tan(d*x)^3*tan(c)^3 + 48*A*b^2*d*x
*tan(d*x)^3*tan(c)^3 - 6*B*a^2*tan(d*x)^4*tan(c)^4 - 12*A*a*b*tan(d*x)^4*tan(c)^4 + 9*B*b^2*tan(d*x)^4*tan(c)^
4 + 24*B*a^2*log(4*(tan(d*x)^4*tan(c)^2 - 2*tan(d*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*
tan(c) + 1)/(tan(c)^2 + 1))*tan(d*x)^3*tan(c)^3 + 48*A*a*b*log(4*(tan(d*x)^4*tan(c)^2 - 2*tan(d*x)^3*tan(c) +
tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan(c) + 1)/(tan(c)^2 + 1))*tan(d*x)^3*tan(c)^3 - 24*B*b^2*log(4
*(tan(d*x)^4*tan(c)^2 - 2*tan(d*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan(c) + 1)/(tan(c
)^2 + 1))*tan(d*x)^3*tan(c)^3 + 12*A*a^2*tan(d*x)^4*tan(c)^3 - 24*B*a*b*tan(d*x)^4*tan(c)^3 - 12*A*b^2*tan(d*x
)^4*tan(c)^3 + 12*A*a^2*tan(d*x)^3*tan(c)^4 - 24*B*a*b*tan(d*x)^3*tan(c)^4 - 12*A*b^2*tan(d*x)^3*tan(c)^4 + 72
*A*a^2*d*x*tan(d*x)^2*tan(c)^2 - 144*B*a*b*d*x*tan(d*x)^2*tan(c)^2 - 72*A*b^2*d*x*tan(d*x)^2*tan(c)^2 - 6*B*a^
2*tan(d*x)^4*tan(c)^2 - 12*A*a*b*tan(d*x)^4*tan(c)^2 + 6*B*b^2*tan(d*x)^4*tan(c)^2 + 12*B*a^2*tan(d*x)^3*tan(c
)^3 + 24*A*a*b*tan(d*x)^3*tan(c)^3 - 24*B*b^2*tan(d*x)^3*tan(c)^3 - 6*B*a^2*tan(d*x)^2*tan(c)^4 - 12*A*a*b*tan
(d*x)^2*tan(c)^4 + 6*B*b^2*tan(d*x)^2*tan(c)^4 + 8*B*a*b*tan(d*x)^4*tan(c) + 4*A*b^2*tan(d*x)^4*tan(c) - 36*B*
a^2*log(4*(tan(d*x)^4*tan(c)^2 - 2*tan(d*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan(c) +
1)/(tan(c)^2 + 1))*tan(d*x)^2*tan(c)^2 - 72*A*a*b*log(4*(tan(d*x)^4*tan(c)^2 - 2*tan(d*x)^3*tan(c) + tan(d*x)^
2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan(c) + 1)/(tan(c)^2 + 1))*tan(d*x)^2*tan(c)^2 + 36*B*b^2*log(4*(tan(d*x
)^4*tan(c)^2 - 2*tan(d*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan(c) + 1)/(tan(c)^2 + 1))
*tan(d*x)^2*tan(c)^2 - 36*A*a^2*tan(d*x)^3*tan(c)^2 + 96*B*a*b*tan(d*x)^3*tan(c)^2 + 48*A*b^2*tan(d*x)^3*tan(c
)^2 - 36*A*a^2*tan(d*x)^2*tan(c)^3 + 96*B*a*b*tan(d*x)^2*tan(c)^3 + 48*A*b^2*tan(d*x)^2*tan(c)^3 + 8*B*a*b*tan
(d*x)*tan(c)^4 + 4*A*b^2*tan(d*x)*tan(c)^4 - 3*B*b^2*tan(d*x)^4 - 48*A*a^2*d*x*tan(d*x)*tan(c) + 96*B*a*b*d*x*
tan(d*x)*tan(c) + 48*A*b^2*d*x*tan(d*x)*tan(c) + 12*B*a^2*tan(d*x)^3*tan(c) + 24*A*a*b*tan(d*x)^3*tan(c) - 24*
B*b^2*tan(d*x)^3*tan(c) - 12*B*a^2*tan(d*x)^2*tan(c)^2 - 24*A*a*b*tan(d*x)^2*tan(c)^2 + 12*B*b^2*tan(d*x)^2*ta
n(c)^2 + 12*B*a^2*tan(d*x)*tan(c)^3 + 24*A*a*b*tan(d*x)*tan(c)^3 - 24*B*b^2*tan(d*x)*tan(c)^3 - 3*B*b^2*tan(c)
^4 - 8*B*a*b*tan(d*x)^3 - 4*A*b^2*tan(d*x)^3 + 24*B*a^2*log(4*(tan(d*x)^4*tan(c)^2 - 2*tan(d*x)^3*tan(c) + tan
(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan(c) + 1)/(tan(c)^2 + 1))*tan(d*x)*tan(c) + 48*A*a*b*log(4*(tan(d
*x)^4*tan(c)^2 - 2*tan(d*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan(c) + 1)/(tan(c)^2 + 1
))*tan(d*x)*tan(c) - 24*B*b^2*log(4*(tan(d*x)^4*tan(c)^2 - 2*tan(d*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x
)^2 - 2*tan(d*x)*tan(c) + 1)/(tan(c)^2 + 1))*tan(d*x)*tan(c) + 36*A*a^2*tan(d*x)^2*tan(c) - 96*B*a*b*tan(d*x)^
2*tan(c) - 48*A*b^2*tan(d*x)^2*tan(c) + 36*A*a^2*tan(d*x)*tan(c)^2 - 96*B*a*b*tan(d*x)*tan(c)^2 - 48*A*b^2*tan
(d*x)*tan(c)^2 - 8*B*a*b*tan(c)^3 - 4*A*b^2*tan(c)^3 + 12*A*a^2*d*x - 24*B*a*b*d*x - 12*A*b^2*d*x - 6*B*a^2*ta
n(d*x)^2 - 12*A*a*b*tan(d*x)^2 + 6*B*b^2*tan(d*x)^2 + 12*B*a^2*tan(d*x)*tan(c) + 24*A*a*b*tan(d*x)*tan(c) - 24
*B*b^2*tan(d*x)*tan(c) - 6*B*a^2*tan(c)^2 - 12*A*a*b*tan(c)^2 + 6*B*b^2*tan(c)^2 - 6*B*a^2*log(4*(tan(d*x)^4*t
an(c)^2 - 2*tan(d*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan(c) + 1)/(tan(c)^2 + 1)) - 12
*A*a*b*log(4*(tan(d*x)^4*tan(c)^2 - 2*tan(d*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan(c)
 + 1)/(tan(c)^2 + 1)) + 6*B*b^2*log(4*(tan(d*x)^4*tan(c)^2 - 2*tan(d*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d
*x)^2 - 2*tan(d*x)*tan(c) + 1)/(tan(c)^2 + 1)) - 12*A*a^2*tan(d*x) + 24*B*a*b*tan(d*x) + 12*A*b^2*tan(d*x) - 1
2*A*a^2*tan(c) + 24*B*a*b*tan(c) + 12*A*b^2*tan(c) - 6*B*a^2 - 12*A*a*b + 9*B*b^2)/(d*tan(d*x)^4*tan(c)^4 - 4*
d*tan(d*x)^3*tan(c)^3 + 6*d*tan(d*x)^2*tan(c)^2 - 4*d*tan(d*x)*tan(c) + d)

________________________________________________________________________________________

maple [A]  time = 0.02, size = 249, normalized size = 1.68 \[ \frac {b^{2} B \left (\tan ^{4}\left (d x +c \right )\right )}{4 d}+\frac {A \left (\tan ^{3}\left (d x +c \right )\right ) b^{2}}{3 d}+\frac {2 B \left (\tan ^{3}\left (d x +c \right )\right ) a b}{3 d}+\frac {A \left (\tan ^{2}\left (d x +c \right )\right ) a b}{d}+\frac {B \,a^{2} \left (\tan ^{2}\left (d x +c \right )\right )}{2 d}-\frac {b^{2} B \left (\tan ^{2}\left (d x +c \right )\right )}{2 d}+\frac {a^{2} A \tan \left (d x +c \right )}{d}-\frac {A \tan \left (d x +c \right ) b^{2}}{d}-\frac {2 B \tan \left (d x +c \right ) a b}{d}-\frac {\ln \left (1+\tan ^{2}\left (d x +c \right )\right ) A a b}{d}-\frac {\ln \left (1+\tan ^{2}\left (d x +c \right )\right ) a^{2} B}{2 d}+\frac {\ln \left (1+\tan ^{2}\left (d x +c \right )\right ) b^{2} B}{2 d}-\frac {A \arctan \left (\tan \left (d x +c \right )\right ) a^{2}}{d}+\frac {A \arctan \left (\tan \left (d x +c \right )\right ) b^{2}}{d}+\frac {2 B \arctan \left (\tan \left (d x +c \right )\right ) a b}{d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(tan(d*x+c)^2*(a+b*tan(d*x+c))^2*(A+B*tan(d*x+c)),x)

[Out]

1/4/d*b^2*B*tan(d*x+c)^4+1/3/d*A*tan(d*x+c)^3*b^2+2/3/d*B*tan(d*x+c)^3*a*b+1/d*A*tan(d*x+c)^2*a*b+1/2/d*B*a^2*
tan(d*x+c)^2-1/2/d*b^2*B*tan(d*x+c)^2+a^2*A*tan(d*x+c)/d-1/d*A*tan(d*x+c)*b^2-2/d*B*tan(d*x+c)*a*b-1/d*ln(1+ta
n(d*x+c)^2)*A*a*b-1/2/d*ln(1+tan(d*x+c)^2)*a^2*B+1/2/d*ln(1+tan(d*x+c)^2)*b^2*B-1/d*A*arctan(tan(d*x+c))*a^2+1
/d*A*arctan(tan(d*x+c))*b^2+2/d*B*arctan(tan(d*x+c))*a*b

________________________________________________________________________________________

maxima [A]  time = 1.26, size = 147, normalized size = 0.99 \[ \frac {3 \, B b^{2} \tan \left (d x + c\right )^{4} + 4 \, {\left (2 \, B a b + A b^{2}\right )} \tan \left (d x + c\right )^{3} + 6 \, {\left (B a^{2} + 2 \, A a b - B b^{2}\right )} \tan \left (d x + c\right )^{2} - 12 \, {\left (A a^{2} - 2 \, B a b - A b^{2}\right )} {\left (d x + c\right )} - 6 \, {\left (B a^{2} + 2 \, A a b - B b^{2}\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + 12 \, {\left (A a^{2} - 2 \, B a b - A b^{2}\right )} \tan \left (d x + c\right )}{12 \, d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)^2*(a+b*tan(d*x+c))^2*(A+B*tan(d*x+c)),x, algorithm="maxima")

[Out]

1/12*(3*B*b^2*tan(d*x + c)^4 + 4*(2*B*a*b + A*b^2)*tan(d*x + c)^3 + 6*(B*a^2 + 2*A*a*b - B*b^2)*tan(d*x + c)^2
 - 12*(A*a^2 - 2*B*a*b - A*b^2)*(d*x + c) - 6*(B*a^2 + 2*A*a*b - B*b^2)*log(tan(d*x + c)^2 + 1) + 12*(A*a^2 -
2*B*a*b - A*b^2)*tan(d*x + c))/d

________________________________________________________________________________________

mupad [B]  time = 6.20, size = 151, normalized size = 1.02 \[ x\,\left (-A\,a^2+2\,B\,a\,b+A\,b^2\right )+\frac {{\mathrm {tan}\left (c+d\,x\right )}^3\,\left (\frac {A\,b^2}{3}+\frac {2\,B\,a\,b}{3}\right )}{d}-\frac {\mathrm {tan}\left (c+d\,x\right )\,\left (-A\,a^2+2\,B\,a\,b+A\,b^2\right )}{d}-\frac {\ln \left ({\mathrm {tan}\left (c+d\,x\right )}^2+1\right )\,\left (\frac {B\,a^2}{2}+A\,a\,b-\frac {B\,b^2}{2}\right )}{d}+\frac {{\mathrm {tan}\left (c+d\,x\right )}^2\,\left (\frac {B\,a^2}{2}+A\,a\,b-\frac {B\,b^2}{2}\right )}{d}+\frac {B\,b^2\,{\mathrm {tan}\left (c+d\,x\right )}^4}{4\,d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(tan(c + d*x)^2*(A + B*tan(c + d*x))*(a + b*tan(c + d*x))^2,x)

[Out]

x*(A*b^2 - A*a^2 + 2*B*a*b) + (tan(c + d*x)^3*((A*b^2)/3 + (2*B*a*b)/3))/d - (tan(c + d*x)*(A*b^2 - A*a^2 + 2*
B*a*b))/d - (log(tan(c + d*x)^2 + 1)*((B*a^2)/2 - (B*b^2)/2 + A*a*b))/d + (tan(c + d*x)^2*((B*a^2)/2 - (B*b^2)
/2 + A*a*b))/d + (B*b^2*tan(c + d*x)^4)/(4*d)

________________________________________________________________________________________

sympy [A]  time = 0.60, size = 246, normalized size = 1.66 \[ \begin {cases} - A a^{2} x + \frac {A a^{2} \tan {\left (c + d x \right )}}{d} - \frac {A a b \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{d} + \frac {A a b \tan ^{2}{\left (c + d x \right )}}{d} + A b^{2} x + \frac {A b^{2} \tan ^{3}{\left (c + d x \right )}}{3 d} - \frac {A b^{2} \tan {\left (c + d x \right )}}{d} - \frac {B a^{2} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + \frac {B a^{2} \tan ^{2}{\left (c + d x \right )}}{2 d} + 2 B a b x + \frac {2 B a b \tan ^{3}{\left (c + d x \right )}}{3 d} - \frac {2 B a b \tan {\left (c + d x \right )}}{d} + \frac {B b^{2} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + \frac {B b^{2} \tan ^{4}{\left (c + d x \right )}}{4 d} - \frac {B b^{2} \tan ^{2}{\left (c + d x \right )}}{2 d} & \text {for}\: d \neq 0 \\x \left (A + B \tan {\relax (c )}\right ) \left (a + b \tan {\relax (c )}\right )^{2} \tan ^{2}{\relax (c )} & \text {otherwise} \end {cases} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)**2*(a+b*tan(d*x+c))**2*(A+B*tan(d*x+c)),x)

[Out]

Piecewise((-A*a**2*x + A*a**2*tan(c + d*x)/d - A*a*b*log(tan(c + d*x)**2 + 1)/d + A*a*b*tan(c + d*x)**2/d + A*
b**2*x + A*b**2*tan(c + d*x)**3/(3*d) - A*b**2*tan(c + d*x)/d - B*a**2*log(tan(c + d*x)**2 + 1)/(2*d) + B*a**2
*tan(c + d*x)**2/(2*d) + 2*B*a*b*x + 2*B*a*b*tan(c + d*x)**3/(3*d) - 2*B*a*b*tan(c + d*x)/d + B*b**2*log(tan(c
 + d*x)**2 + 1)/(2*d) + B*b**2*tan(c + d*x)**4/(4*d) - B*b**2*tan(c + d*x)**2/(2*d), Ne(d, 0)), (x*(A + B*tan(
c))*(a + b*tan(c))**2*tan(c)**2, True))

________________________________________________________________________________________